:root,
:host {
  --van-dialog-width: 320px;
  --van-dialog-small-screen-width: 90%;
  --van-dialog-font-size: var(--van-font-size-lg);
  --van-dialog-transition: var(--van-duration-base);
  --van-dialog-radius: 16px;
  --van-dialog-background: var(--van-background-2);
  --van-dialog-header-font-weight: var(--van-font-bold);
  --van-dialog-header-line-height: 24px;
  --van-dialog-header-padding-top: 26px;
  --van-dialog-header-isolated-padding: var(--van-padding-lg) 0;
  --van-dialog-message-padding: var(--van-padding-lg);
  --van-dialog-message-font-size: var(--van-font-size-md);
  --van-dialog-message-line-height: var(--van-line-height-md);
  --van-dialog-message-max-height: 60vh;
  --van-dialog-has-title-message-text-color: var(--van-gray-7);
  --van-dialog-has-title-message-padding-top: var(--van-padding-xs);
  --van-dialog-button-height: 48px;
  --van-dialog-round-button-height: 36px;
  --van-dialog-confirm-button-text-color: var(--van-primary-color);
}

.van-dialog {
  top: 45%;
  width: var(--van-dialog-width);
  overflow: hidden;
  font-size: var(--van-dialog-font-size);
  background: var(--van-dialog-background);
  border-radius: var(--van-dialog-radius);
  backface-visibility: hidden; // avoid blurry text after scale animation
  transition: var(--van-dialog-transition);
  transition-property: transform, opacity;

  @media (max-width: 321px) {
    width: var(--van-dialog-small-screen-width);
  }

  &__header {
    color: var(--van-text-color);
    padding-top: var(--van-dialog-header-padding-top);
    font-weight: var(--van-dialog-header-font-weight);
    line-height: var(--van-dialog-header-line-height);
    text-align: center;

    &--isolated {
      padding: var(--van-dialog-header-isolated-padding);
    }
  }

  &__content {
    &--isolated {
      display: flex;
      align-items: center;
      min-height: 104px;
    }
  }

  &__message {
    color: var(--van-text-color);
    flex: 1;
    max-height: var(--van-dialog-message-max-height);
    padding: 26px var(--van-dialog-message-padding);
    overflow-y: auto;
    font-size: var(--van-dialog-message-font-size);
    line-height: var(--van-dialog-message-line-height);

    // allow newline character
    white-space: pre-wrap;
    text-align: center;
    word-wrap: break-word;
    -webkit-overflow-scrolling: touch;

    &--has-title {
      padding-top: var(--van-dialog-has-title-message-padding-top);
      color: var(--van-dialog-has-title-message-text-color);
    }

    &--left {
      text-align: left;
    }

    &--right {
      text-align: right;
    }

    &--justify {
      text-align: justify;
    }
  }

  &__footer {
    display: flex;
    overflow: hidden;
    user-select: none;
  }

  &__confirm,
  &__cancel {
    flex: 1;
    height: var(--van-dialog-button-height);
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  &__confirm {
    &,
    &:active {
      color: var(--van-dialog-confirm-button-text-color);
    }
  }

  &--round-button {
    .van-dialog__footer {
      position: relative;
      height: auto;
      padding: var(--van-padding-xs) var(--van-padding-lg) var(--van-padding-md);
    }

    .van-dialog__message {
      padding-bottom: var(--van-padding-md);
      color: var(--van-text-color);
    }

    .van-dialog__confirm,
    .van-dialog__cancel {
      height: var(--van-dialog-round-button-height);
    }

    .van-dialog__confirm {
      color: var(--van-white);
    }

    .van-action-bar-button {
      &--first {
        border-top-left-radius: var(--van-radius-max);
        border-bottom-left-radius: var(--van-radius-max);
      }

      &--last {
        border-top-right-radius: var(--van-radius-max);
        border-bottom-right-radius: var(--van-radius-max);
      }
    }
  }

  &-bounce-enter-from {
    transform: translate3d(0, -50%, 0) scale(0.7);
    opacity: 0;
  }

  &-bounce-leave-active {
    transform: translate3d(0, -50%, 0) scale(0.9);
    opacity: 0;
  }
}
